package com.hoshiicloud.payment.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @program: hoshiicloud
 * @description: 支付回调地址等参数配置类,通过配置文件初始化
 * @author: Mr.wu
 * @create: 2019-05-25 11:25
 **/
@Configuration
public class PayConfig {
    /**
     * 流程测试,打开时如第三方接口调用错误也会执行接口逻辑
     */
    public static boolean processDebug=false;

    /**
     * 支付接口测试环境
     */
    public static boolean debug=false;

    /**
     * 微信支付回调地址
     */
    private static String WEIXIN_PAY_NOTITY;

    /**
     * 微信退款回调地址
     */
    private static String WEIXIN_REFUND_NOTITY;

    public static String getWeixinPayNotity() {
        return WEIXIN_PAY_NOTITY;
    }
    @Value("${weixin.payNotify}")
    public void setWeixinPayNotity(String weixinPayNotity) {
        PayConfig.WEIXIN_PAY_NOTITY = weixinPayNotity;
    }

    public static String getWeixinRefundNotity() {
        return WEIXIN_REFUND_NOTITY;
    }
    @Value("${weixin.refundNotify}")
    public void setWeixinRefundNotity(String weixinRefundNotity) {
        WEIXIN_REFUND_NOTITY = weixinRefundNotity;
    }

    @Value("${pay.processDebug}")
    public void setProcessDebug(boolean processDebug) {
        PayConfig.processDebug = processDebug;
    }
    @Value("${pay.debug}")
    public void setDebug(boolean debug) {
        PayConfig.debug = debug;
    }
}
